# -*- coding: utf-8 -*-
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend

import logging

from django.contrib.auth.models import AnonymousUser

logger = logging.getLogger(__name__)


class CustomModelBackend(ModelBackend):

    def authenticate(self, request, username=None, password=None, **kwargs):
        logger.info('authenticate')
        # token = request._request.GET.get('token')
        # if not token:
        #     raise AuthenticationFailed('AuthenticationFailed')
        user = get_user_model().objects.filter(username='admin').first()
        return user

    pass

